package com.springcloud.zuul.config;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

/**
 * @Author PuaChen
 * @Create 2018-11-19 16:15
 */
@Mapper
public interface GenerateUUID {

    @Select(
            "<script>SELECT substring(${uuid},-4)uuid FROM ${database}.${surface} where TO_DAYS(instm)=" +
                    "      TO_DAYS(NOW())" +
                    "      <if test=\"comval !=null and comval !='' \">" +
                    "        and substring_index(${uuid},'-',1)=#{comval}" +
                    "      </if>" +
                    "      ORDER BY substring(${uuid},-4) desc LIMIT 1</script>"
    )
    Map<String, Object> getUuid(Map<String, Object> params);

}
